let list = {
    data() {
        return {
            // 表格高度
            maxTableHeight: `${document.documentElement.clientHeight}` - 230,
            // 表格数据
            tableData: [],
            // 分页信息
            pageInfo: {
                page: 1,
                pageSize: 10,
                total: 0,
            },
        };
    },
    created() {
        this.remoteTableData();
        this.remoteOtherData();
    },
    methods: {
        // 打开弹窗（新增或编辑弹窗）
        openDialog(row) {
            this.beforeOpen();
            if (row) {
                this.$refs["updateDialog"].openUpdate(row);
            } else {
                this.$refs["updateDialog"].openSave();
            }
        },
        beforeOpen() {

        },
        // 根据查询条件，检索数据
        querySearchForm() {
            this.clearTableData(10);
            this.remoteTableData();
        },
        // 清空查询条件，检索数据
        resetSearchForm() {
            if (this.$refs['queryForm']) {
                this.$refs['queryForm'].resetFields();
            }

            this.clearTableData(10);
            this.remoteTableData();
        },
        // 分页标签：每页数量变化
        handleSizeChange(val) {
            this.clearTableData(val);
            this.pageInfo.pageSize = val;
            this.remoteTableData();
        },
        // 分页标签：当前页码变化
        handleCurrentChange(val) {
            this.pageInfo.page = val;
            this.remoteTableData();
        },
        // 清空表格数据
        clearTableData(pageSize) {
            this.pageInfo = {
                page: 1,
                pageSize: pageSize,
                total: 0,
            };
            this.tableData = [];
        },
        // 更新表格数据
        updateTableData(data) {
            this.pageInfo = {
                page: data.current,
                pageSize: data.size,
                total: data.total,
            };
            this.tableData = data.records;
        },
        updateNoPageTableData(data) {
            this.tableData = data;
        },
        // 权限判断
        hasPermission(permission) {
            return this.user.permissionArr.includes(permission);
        },
        // 权限判断
        hasAnyPermission() {
            for (var key in this.permission) {
                if (key != "save" && this.user.permissionArr.includes(this.permission[key])) {
                    return true;
                }
            }
            return false;
        },
        // 检索参数
        searchParams() {
            return {
                page: this.pageInfo.page,
                pageSize: this.pageInfo.pageSize,
                ...this.query
            }
        },
        remoteOtherData() {
            
        }
    }
}

export default list;